#include<bits/stdc++.h>
using namespace std;
/**
 * Sn = a1 * n + n * (n - 1) * d / 2; n为数量
 * 2 * row^2 - 1 ≤ n
 * row <= √[( n + 1 ) / 2]
 * 
 * */
void output(int row, char ch) {
    for (int i = row; i >= 1; i--) {
        // cout space;
        for (int _ = 1; _ <= row -  i; _++) {
            cout << " ";
        }
        // cout character
        for (int _ = 1; _ <= 2 * i - 1; _++) {
            cout << ch;
        }
        cout << endl;
    }
    for (int i = 2; i <= row; i++) {
        // cout space;
        for (int _ = 1; _ <= row -  i; _++) {
            cout << " ";
        }
        // cout character
        for (int _ = 1; _ <= 2 * i - 1; _++) {
            cout << ch;
        }
        cout << endl;
    }
}


int main () {
    int n;  
    char ch;
    cin >> n >> ch;
    int row = sqrt((n + 1) / 2);
    output(row, ch);
    cout << n - 2 * row * row + 1 << endl;
    return 0;
} 